home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / pctchnqs / 1990 / number1 / uformgen.pas < prev    next >
Pascal/Delphi Source File  |  1989-12-07  |  1KB  |  46 lines

  1. (*
  2. **    File:    uformgen.pas
  3. **    Purpose: Routines for generating new CARDFILE forms.
  4. **    Author:  (c) 1989 by Tom Swan. All rights reserved.
  5. *)
  6.  
  7. unit UFormGen;
  8.  
  9. interface
  10.  
  11. uses  Crt, Objects, Cards, Forms, Sliders, UNewType;
  12.  
  13. const SIGNATURE : Longint = $44524143;    { Do not change! }
  14.  
  15. type  NewFormProc = procedure;
  16.  
  17. var
  18.   theForm: Form;
  19.   theCards: CardList;
  20.   theStream: FStream;
  21.  
  22. procedure makeFile( formp : NewFormProc; filename : FNameStr );
  23.  
  24.  
  25. implementation
  26.  
  27. {---- Create a new card file }
  28.  
  29. procedure makeFile( formp : NewFormProc; filename : FNameStr );
  30. begin
  31.    formp;   { Create the new form in memory }
  32.    theCards.init( theForm.size );
  33.    theStream.init( filename, SCREATE, 1024 );
  34.    theStream.write( SIGNATURE, sizeof(Longint) );
  35.    theForm.store( theStream );
  36.    theCards.store( theStream );
  37.    theStream.flush;
  38.    if theStream.status <> 0 
  39.       then writeln( 'Error creating file ', filename );
  40.    theStream.done;
  41.    theCards.done;
  42.    theForm.done;
  43. end; { makeFile }
  44.  
  45. end. { UFormGen }
  46.